package com.xcity.game.item.drop;

import java.util.Random;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.xcity.db.entity.Player;
import com.xcity.game.item.drop.listener.DropListener;

/**
 * 一个掉落(物品、现金、经验等)
 * @author yang.li
 *
 */
public interface Drop {

	Random RND = new Random();
	Logger LOG = LoggerFactory.getLogger(Drop.class);
	
	/**
	 * 触发掉落
	 * @param rnd
	 * @param player 目标玩家
	 * @param cause 掉落原因
	 * @return 是否成功掉落
	 */
	boolean drop(Random rnd, Player player, String cause, DropListener listener);
	
	default boolean drop(Player player, String cause) {
		return drop(RND, player, cause, null);
	}
	
}
